Page({

  /**
   * 页面的初始数据
   */
  data: {
    mold: "", //1基本信息 2照骗
    type: "", //1个人 2企业
    info: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let _self = this;
    const eventChannel = this.getOpenerEventChannel();
    eventChannel.on('acceptDataFromOpenerPage', function (data) {
      _self.setData({
        info: data
      })
    })
    const {
      mold = 2, type = 2
    } = options;
    this.setData({
      mold,
      type
    })
  },

  //预览图片
  previewImg(e) {
    const {
      current
    } = e.currentTarget.dataset;
    let urls;
    if (this.data.type == 1) {
      urls = [
        this.data.info.personal_ID_card_head_img_link,
        this.data.info.personal_ID_card_national_emblem_link,
      ];
    } else {
      urls = [
        this.data.info.company_business_license_link
      ];
    }
    wx.previewImage({
      current,
      urls,
    })
  }
})